package com.hirsi.common.core.convert;

import lombok.SneakyThrows;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
@ConfigurationPropertiesBinding
public class ObjectWrapperFactoryConverter implements Converter<String, ObjectWrapperFactory> {
    @SneakyThrows
    @Override
    public ObjectWrapperFactory convert(String s) {
        return (ObjectWrapperFactory) Class.forName(s).newInstance();
    }
}
